package cn.smile.commons.enums.basic;

import lombok.Getter;
import org.springframework.util.ObjectUtils;

import java.util.Objects;

@Getter
public enum MiniProjectCountEnum {
    /**
     * 今天
     */
    TODAY(1, "今天"),
    /**
     * 最近7天
     */
    LAST_SEVEN_DAYS(2, "最近7天"),
    /**
     * 未知
     */
    NULL(-1, "未知");

    private final Integer sn;
    private final String msg;

    MiniProjectCountEnum(Integer sn, String msg) {
        this.sn = sn;
        this.msg = msg;
    }

    public static MiniProjectCountEnum get(Integer code) {
        if (!ObjectUtils.isEmpty(code)) {
            for (MiniProjectCountEnum status : values()) {
                if (Objects.equals(status.getSn(), code)) {
                    return status;
                }
            }
        }
        return NULL;
    }
}
